package com.example.smartmedicalsystem.repository;

import com.example.smartmedicalsystem.entity.Message;
import com.example.smartmedicalsystem.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;

public interface MessageRepository extends JpaRepository<Message, Long> {
    List<Message> findByReceiverIdAndIsReadFalse(Long receiverId);
    List<Message> findByReceiverIdOrderByCreatedAtDesc(Long receiverId);
    List<Message> findBySenderId(Long senderId);
    List<Message> findByReceiverOrderByCreatedAtDesc(User receiver);
}